package cn.pconline.autoclub.entity;

import cn.pconline.autoclub.util.EncodeUtils;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
import org.gelivable.dao.Column;
import org.gelivable.dao.Entity;
import org.gelivable.dao.Id;

/**
 * 车友会的收货地址
 *
 * @author chensy
 */
@Entity(tableName = "ac_club_address")
public class ClubAddress {

    @Id
    @Column(name = "club_id")
    private long clubId;//车友会Id
    @Column(name = "province_id")
    private long provinceId;//省份Id
    @Column(name = "city_id")
    private long cityId;//城市Id
    @Column(name = "province_name")
    private String provinceName;//省份名称
    @Column(name = "city_name")
    private String cityName;//城市名称
    @Column(name = "address")
    private String address;//详细地址
    @Column(name = "postcode")
    private String postcode;//邮编
    @Column(name = "name")
    private String name;//收货人姓名
    @Column(name = "phone")
    private String phone;//收货人手机
    @Column(name = "update_by")
    private long updateBy;//更新人Id
    @Column(name = "update_at")
    private Date updateAt;//更新时间

    public long getClubId() {
        return clubId;
    }

    public void setClubId(long clubId) {
        this.clubId = clubId;
    }

    public long getProvinceId() {
		return provinceId;
	}

	public void setProvinceId(long provinceId) {
		this.provinceId = provinceId;
	}

	public long getCityId() {
		return cityId;
	}

	public void setCityId(long cityId) {
		this.cityId = cityId;
	}

	public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPostcode() {
        return postcode;
    }

    public void setPostcode(String postcode) {
        this.postcode = postcode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public long getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(long updateBy) {
        this.updateBy = updateBy;
    }

    public Date getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Date updateAt) {
        this.updateAt = updateAt;
    }
    
    public JSONObject toJson(){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("addressProvinceId", getProvinceId());
        jsonObject.put("addressUserName", getName());
        jsonObject.put("addressPhone", getPhone());
        jsonObject.put("addressProvinceName", getProvinceName());
        jsonObject.put("addressCityName", getCityName());
        jsonObject.put("addressDetail", getAddress());
        jsonObject.put("addressPostcode", getPostcode());        
        return jsonObject;
    }
    
    public JSONObject toJsonEncodeHTML(){
        JSONObject jsonObject = toJson();
        jsonObject.put("addressUserName", EncodeUtils.encodeForHTMLFilterNull(getName()));
        jsonObject.put("addressProvinceName", EncodeUtils.encodeForHTMLFilterNull(getProvinceName()));
        jsonObject.put("addressCityName", EncodeUtils.encodeForHTMLFilterNull(getCityName()));
        jsonObject.put("addressDetail", EncodeUtils.encodeForHTMLFilterNull(getAddress()));
        return jsonObject;
    }
}
